package kr.hkit.powerjava.chapter22.collection;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class LinkedListTest {
	public static void main(String[] args) {
		/*Linked*/List<String> arList = new LinkedList<>();		//부모 = List (java.util)
		arList.add("Milk");				//index 0
		arList.add("Bread");			//index 1
		arList.add("Butter");			//index 2	

		arList.add(1, "APPLE");
//		System.out.println(arList.indexOf("Butter"));
		arList.set(2, "Grape");			//index 2번을 "Grape"로 변경하라	

		String temp = arList.remove(0);
		System.out.println("제거된 문자열 " + temp);

		Collections.sort(arList);		//arList 정렬
		for (String str : arList) {		//for-each문을 통해서 arList 모두 출력
			System.out.println(str);
		}

	}
}
